
// Open MoneySpinner Suite v1
// An open source business management software system written in Java and MySQL
// Recommended IDE is NetBeans IDE 7.0.1
// Support Web Site: http://www.milliscript.com
//
// Copyright (C) 2014, Abiodun Aremu, Ibadan/NIGERIA.
// Open MoneySpinner Suite is distributed under the terms of the Apache License version 2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package openmoneyspinnersuite;

/**
 *
 * @author Abiodun Aremu
 */
import javax.swing.*;
import java.text.*;

final class ViewPendingDebitOrder extends javax.swing.JInternalFrame {

    Object[][] tableObject=new Object[][]{};
    Systems systems=new Systems();
        String creditBy;
        String creditByID;
        String orderBy;
        String orderByID;
        String consentBy;
        String consentByID;
        String accountCode;
        String accountUnit;
        String accountName;
        String creditCode;
        String refDepartmentCode;
        String postDate;
        String orderDate;
        String totalAmount;
        String toBalance;
        String amtDue;
        String[] dbSerial;
        String[] dbItem;
        String[] dbDescription;
        String[] dbAmount;
        String transactionType;
        String transactionTypeCode;
        String transactionNumber;
        String transactionDate;
        String[] dbCreditCode;
        String[] dbCreditDate;
        DateFormat dateFormat=DateFormat.getDateInstance(DateFormat.LONG);
        Thread processThread=new Thread();
        Thread titleThread=new Thread();

    /** Creates new form ViewPendingCreditOrder */
    public ViewPendingDebitOrder() {
        initComponents();
        setTitle("::. View Pending Debit Order");
        resetOrderCode();
        resetTable();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jNameTextField = new javax.swing.JTextField();
        jComboBox1 = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jTotAmountTextField = new javax.swing.JTextField();
        jOrderDateTextField = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jPreviewButton = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jRefDepartmentTextField = new javax.swing.JTextField();
        jTransactionTypeTextField = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jTransactionNumberTextField = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jTransactionDateTextField = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jCostOrderCodeTextField = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jAccountNameTextField = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jTransactionUnitTextField = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jActivityTextField = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jCheckBox1 = new javax.swing.JCheckBox();
        jCheckBox2 = new javax.swing.JCheckBox();
        jAmtDueTextField = new javax.swing.JTextField();
        jToBalanceTextField = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jCancelButton = new javax.swing.JButton();
        jCheckBox5 = new javax.swing.JCheckBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();

        setClosable(true);
        setIconifiable(true);
        setMaximizable(true);
        setResizable(true);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(openmoneyspinnersuite.OpenMS_Finance_App.class).getContext().getResourceMap(ViewPendingDebitOrder.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setFrameIcon(resourceMap.getIcon("Form.frameIcon")); // NOI18N
        setName("Form"); // NOI18N
        setVisible(true);

        jPanel1.setName("jPanel1"); // NOI18N

        jLabel1.setFont(resourceMap.getFont("jLabel6.font")); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jNameTextField.setEditable(false);
        jNameTextField.setName("jNameTextField"); // NOI18N
        jNameTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jNameTextFieldActionPerformed(evt);
            }
        });

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-- Select --" }));
        jComboBox1.setName("jComboBox1"); // NOI18N
        jComboBox1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox1ActionPerformed(evt);
            }
        });

        jLabel2.setFont(resourceMap.getFont("jLabel6.font")); // NOI18N
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel4.setFont(resourceMap.getFont("jLabel6.font")); // NOI18N
        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jTotAmountTextField.setEditable(false);
        jTotAmountTextField.setName("jTotAmountTextField"); // NOI18N
        jTotAmountTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTotAmountTextFieldActionPerformed(evt);
            }
        });

        jOrderDateTextField.setEditable(false);
        jOrderDateTextField.setName("jOrderDateTextField"); // NOI18N
        jOrderDateTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jOrderDateTextFieldActionPerformed(evt);
            }
        });

        jLabel5.setFont(resourceMap.getFont("jLabel6.font")); // NOI18N
        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jPreviewButton.setText(resourceMap.getString("jPreviewButton.text")); // NOI18N
        jPreviewButton.setName("jPreviewButton"); // NOI18N
        jPreviewButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jPreviewButtonActionPerformed(evt);
            }
        });

        jLabel3.setFont(resourceMap.getFont("jLabel6.font")); // NOI18N
        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jRefDepartmentTextField.setEditable(false);
        jRefDepartmentTextField.setName("jRefDepartmentTextField"); // NOI18N
        jRefDepartmentTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRefDepartmentTextFieldActionPerformed(evt);
            }
        });

        jTransactionTypeTextField.setEditable(false);
        jTransactionTypeTextField.setName("jTransactionTypeTextField"); // NOI18N
        jTransactionTypeTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTransactionTypeTextFieldActionPerformed(evt);
            }
        });

        jLabel6.setFont(resourceMap.getFont("jLabel6.font")); // NOI18N
        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        jTransactionNumberTextField.setEditable(false);
        jTransactionNumberTextField.setName("jTransactionNumberTextField"); // NOI18N
        jTransactionNumberTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTransactionNumberTextFieldActionPerformed(evt);
            }
        });

        jLabel7.setFont(resourceMap.getFont("jLabel6.font")); // NOI18N
        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        jTransactionDateTextField.setEditable(false);
        jTransactionDateTextField.setName("jTransactionDateTextField"); // NOI18N
        jTransactionDateTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTransactionDateTextFieldActionPerformed(evt);
            }
        });

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        jCostOrderCodeTextField.setEditable(false);
        jCostOrderCodeTextField.setName("jCostOrderCodeTextField"); // NOI18N
        jCostOrderCodeTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCostOrderCodeTextFieldActionPerformed(evt);
            }
        });

        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        jAccountNameTextField.setEditable(false);
        jAccountNameTextField.setName("jAccountNameTextField"); // NOI18N
        jAccountNameTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jAccountNameTextFieldActionPerformed(evt);
            }
        });

        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N

        jTransactionUnitTextField.setEditable(false);
        jTransactionUnitTextField.setName("jTransactionUnitTextField"); // NOI18N
        jTransactionUnitTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTransactionUnitTextFieldActionPerformed(evt);
            }
        });

        jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
        jLabel11.setName("jLabel11"); // NOI18N

        jLabel12.setFont(resourceMap.getFont("jLabel12.font")); // NOI18N
        jLabel12.setText(resourceMap.getString("jLabel12.text")); // NOI18N
        jLabel12.setName("jLabel12"); // NOI18N

        jActivityTextField.setEditable(false);
        jActivityTextField.setName("jActivityTextField"); // NOI18N
        jActivityTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jActivityTextFieldActionPerformed(evt);
            }
        });

        jLabel13.setText(resourceMap.getString("jLabel13.text")); // NOI18N
        jLabel13.setName("jLabel13"); // NOI18N

        jCheckBox1.setText(resourceMap.getString("jCheckBox1.text")); // NOI18N
        jCheckBox1.setName("jCheckBox1"); // NOI18N

        jCheckBox2.setText(resourceMap.getString("jCheckBox2.text")); // NOI18N
        jCheckBox2.setName("jCheckBox2"); // NOI18N

        jAmtDueTextField.setEditable(false);
        jAmtDueTextField.setName("jAmtDueTextField"); // NOI18N
        jAmtDueTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jAmtDueTextFieldActionPerformed(evt);
            }
        });

        jToBalanceTextField.setEditable(false);
        jToBalanceTextField.setName("jToBalanceTextField"); // NOI18N
        jToBalanceTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToBalanceTextFieldActionPerformed(evt);
            }
        });

        jLabel14.setText(resourceMap.getString("jLabel14.text")); // NOI18N
        jLabel14.setName("jLabel14"); // NOI18N

        jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
        jLabel15.setName("jLabel15"); // NOI18N

        jCancelButton.setIcon(resourceMap.getIcon("jCancelButton.icon")); // NOI18N
        jCancelButton.setText(resourceMap.getString("jCancelButton.text")); // NOI18N
        jCancelButton.setName("jCancelButton"); // NOI18N
        jCancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCancelButtonActionPerformed(evt);
            }
        });

        jCheckBox5.setText(resourceMap.getString("jCheckBox5.text")); // NOI18N
        jCheckBox5.setName("jCheckBox5"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel1)
                                .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, 107, Short.MAX_VALUE)
                            .addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, 107, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jToBalanceTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE)
                            .addComponent(jAmtDueTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE)
                            .addComponent(jTransactionNumberTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE)
                            .addComponent(jTransactionDateTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE)
                            .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTransactionUnitTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE)
                            .addComponent(jTotAmountTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE)
                            .addComponent(jNameTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE)
                            .addComponent(jTransactionTypeTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE))
                        .addGap(113, 113, 113)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                .addComponent(jPreviewButton)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jCancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel3)
                                    .addComponent(jLabel5)
                                    .addComponent(jLabel13)
                                    .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jCostOrderCodeTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)
                                    .addComponent(jRefDepartmentTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)
                                    .addComponent(jAccountNameTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)
                                    .addComponent(jOrderDateTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)
                                    .addComponent(jActivityTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jCheckBox1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jCheckBox2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jCheckBox5))))
                    .addComponent(jLabel12))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4)
                            .addComponent(jNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel6)
                            .addComponent(jTransactionTypeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(jTransactionNumberTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTransactionDateTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jCostOrderCodeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel9))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jAccountNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel10))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(jRefDepartmentTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jOrderDateTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jActivityTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel11)
                            .addComponent(jTransactionUnitTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTotAmountTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jAmtDueTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel15)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jCheckBox1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jCheckBox2)
                            .addComponent(jCheckBox5))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jCancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jPreviewButton, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(7, 7, 7)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jToBalanceTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel14))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel12))
        );

        jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "S/N", "Item", "Description", "Amount"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTable1.setName("jTable1"); // NOI18N
        jScrollPane1.setViewportView(jTable1);
        jTable1.getColumnModel().getColumn(0).setPreferredWidth(10);
        jTable1.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("jTable1.columnModel.title0")); // NOI18N
        jTable1.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("jTable1.columnModel.title3")); // NOI18N
        jTable1.getColumnModel().getColumn(2).setHeaderValue(resourceMap.getString("jTable1.columnModel.title4")); // NOI18N
        jTable1.getColumnModel().getColumn(3).setHeaderValue(resourceMap.getString("jTable1.columnModel.title5")); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 1000, Short.MAX_VALUE)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 276, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jNameTextFieldActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jNameTextFieldActionPerformed

    private void jTotAmountTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTotAmountTextFieldActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jTotAmountTextFieldActionPerformed

    private void jOrderDateTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jOrderDateTextFieldActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jOrderDateTextFieldActionPerformed

    public void print()
    {
        try
        {
            jTable1.print();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
    private void jPreviewButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPreviewButtonActionPerformed
        
        /* Execute thread */
        processThread=new Thread(new Runnable() {
            public void run() {
            disableControls();
            previewDoc();
            }
        });
        titleThread=new Thread(new Runnable() {
            public void run() {
                while(processThread.isAlive())setProcessingTitle(titleThread);
                enableControls();
                System.out.println("viewItemThread stopped runing.");
            }
        });
        processThread.start();
        titleThread.start();
    }//GEN-LAST:event_jPreviewButtonActionPerformed
    private void previewDoc()
    {
        String transferState="";
        int quantity=1;
        if(jActivityTextField.getText().trim().equalsIgnoreCase("Transfer Activity"))
        {
            transferState="Transfer";
        }
       if(jComboBox1.getSelectedItem().equals("-- Select --"))
        {
            JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),"Please Select a Order Code ","ERROR !",JOptionPane.ERROR_MESSAGE);
            return;
        }
        //java.lang.Runtime run=java.lang.Runtime.getRuntime();
        //java.lang.Runtime runAgain=java.lang.Runtime.getRuntime();
//        javax.swing.JInternalFrame printVoucher=new PrintVoucher(String.valueOf(jComboBox1.getSelectedItem()).trim());
//        this.getDesktopPane().add(printVoucher);
//        this.getDesktopPane().moveToFront(printVoucher); 
        if(jCheckBox5.isSelected())
        {
            boolean found=false;
            javax.swing.JInternalFrame allIntFr[]=this.getDesktopPane().getAllFrames();
            for(javax.swing.JInternalFrame iFr:allIntFr)
            {
                if(iFr.getTitle().equalsIgnoreCase("::. Preview POS Receipt"))
                {
                    ((POSPrint)iFr).setReceiptValue(String.valueOf(jComboBox1.getSelectedItem()).trim());
                    found=true;
                }
            }
            if(found==false)
                this.getDesktopPane().add(new POSPrint(String.valueOf(jComboBox1.getSelectedItem()).trim()));
            return;
        }
        try
        {
            NoteWriter note=new NoteWriter();
            note.writeVoucher(jComboBox1.getSelectedItem().toString(),transferState,quantity);
                                   
            if(OpenMSApp.d==null)
            {
                OpenMSApp.d=new NoteViewer("Preview Voucher - "+jComboBox1.getSelectedItem().toString(),Configuration.officialVoucherURLPath);
                OpenMSApp.d.setVisible(true);
            }
            else if(OpenMSApp.d.isVisible()==false)
            {
                OpenMSApp.d=new NoteViewer("Preview Voucher - "+jComboBox1.getSelectedItem().toString(),Configuration.officialVoucherURLPath);
                OpenMSApp.d.setVisible(true);       
            }
            else{
                OpenMSApp.d.setTitle("Preview Voucher - "+jComboBox1.getSelectedItem().toString());
                OpenMSApp.d.doTas(2);
                OpenMSApp.d.transferFocus();
                
            }
            //run.exec("explorer C:\\Milliscript_MoneySpinner\\Note\\OfficialVoucher.htm");
            /*run.exec("explorer "+Configuration.officialVoucherPath);
            if(jCheckBox2.isSelected()){
            run.exec("C:\\Program Files\\PrintHTML\\printhtml.exe file=\""+Configuration.officialVoucherPath+"\" ");
            if(jCheckBox1.isSelected())
            {
                runAgain.exec("C:\\Program Files\\PrintHTML\\printhtml.exe file=\""+Configuration.officialVoucherPath+"\" ");
            }
            }*/
//            printVoucher.setSelected(true);
        }
        catch(Exception e)
        {
            System.out.println("Error while adding print voucher ! "+e);
        }
    }
    void printDoc(){
        String transferState="";
        if(jActivityTextField.getText().trim().equalsIgnoreCase("Transfer Activity"))
        {
            transferState="Transfer";
        }
       if(jComboBox1.getSelectedItem().equals("-- Select --"))
        {
            JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),"Please Select a Order Code ","ERROR !",JOptionPane.ERROR_MESSAGE);
            return;
        }
        java.lang.Runtime run=java.lang.Runtime.getRuntime();
        java.lang.Runtime runAgain=java.lang.Runtime.getRuntime();
//        javax.swing.JInternalFrame printVoucher=new PrintVoucher(String.valueOf(jComboBox1.getSelectedItem()).trim());
//        this.getDesktopPane().add(printVoucher);
//        this.getDesktopPane().moveToFront(printVoucher);
        try
        {
            NoteWriter note=new NoteWriter();
            note.writeVoucher(jComboBox1.getSelectedItem().toString(),transferState,1);
            //run.exec("explorer C:\\Milliscript_MoneySpinner\\Note\\OfficialVoucher.htm");
            if(jCheckBox2.isSelected())
            {
                run.exec("explorer "+Configuration.officialVoucherPath);
            }
            
            run.exec("C:\\Program Files\\PrintHTML\\printhtml.exe file=\""+Configuration.officialVoucherPath+"\" ");  
                
            if(jCheckBox1.isSelected())
            {
                runAgain.exec("C:\\Program Files\\PrintHTML\\printhtml.exe file=\""+Configuration.officialVoucherPath+"\" ");
            }
//            printVoucher.setSelected(true);
        }
        catch(Exception e)
        {
            System.out.println("Error while adding print voucher ! "+e);
        }
    }

    private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
                
        /* Execute thread */
        processThread=new Thread(new Runnable() {
            public void run() {
            disableControls();
            orderCodeSelected();
            }
        });
        titleThread=new Thread(new Runnable() {
            public void run() {
                while(processThread.isAlive())setProcessingTitle(titleThread);
                enableControls();
                System.out.println("viewItemThread stopped runing.");
            }
        });
        processThread.start();
        titleThread.start();
    }//GEN-LAST:event_jComboBox1ActionPerformed
    private void orderCodeSelected()
    {
            String orderCode=jComboBox1.getSelectedItem().toString();
            resetField();

        if(orderCode.equals("-- Select --"))
        {
            resetOrderCode();
            resetTable();
        }
       else
       {
            creditByID=systems.getValue(OpenMSApp.Database_A, "Select * from debitOrder where cDebitOrderCode='"+orderCode+"'", "cMerchantID");
            orderByID=systems.getValue(OpenMSApp.Database_A, "Select * from debitOrder where cDebitOrderCode='"+orderCode+"'", "cOrderByID");
            orderDate=systems.getValue(OpenMSApp.Database_A, "Select * from debitOrder where cDebitOrderCode='"+orderCode+"'", "dOrderDate");
            totalAmount=systems.getValue(OpenMSApp.Database_A, "Select * from debitOrder where cDebitOrderCode='"+orderCode+"'", "mTotalAmount");
            accountCode=systems.getValue(OpenMSApp.Database_A, "Select * from debitOrder where cDebitOrderCode='"+orderCode+"'", "cAccountCode");
            transactionDate=systems.extractSQLDate(systems.getDateValue(OpenMSApp.Database_A, "Select * from debitOrder where cDebitOrderCode='"+orderCode+"'", "dDebitDate"));
            transactionNumber=systems.getValue(OpenMSApp.Database_A, "Select * from debitOrder where cDebitOrderCode='"+orderCode+"'", "vDebitingNumber");
            transactionTypeCode=systems.getValue(OpenMSApp.Database_A, "Select * from debitOrder where cDebitOrderCode='"+orderCode+"'", "cTransactionTypeCode");
            refDepartmentCode=systems.getValue(OpenMSApp.Database_A, "Select * from debitOrder where cDebitOrderCode='"+orderCode+"'", "cReferalDepartmentCode");
            toBalance=systems.getValue(OpenMSApp.Database_A, "Select * from debitOrder where cDebitOrderCode='"+orderCode+"'", "mToBalance");

            dbDescription=systems.getColumn(OpenMSApp.Database_A,"Select * from debitordersummary where cDebitOrderCode= '"+orderCode+"'",3);
            dbAmount=systems.getColumn(OpenMSApp.Database_A,"Select * from debitordersummary where cDebitOrderCode='"+orderCode+"'",4);
            dbSerial=systems.getColumn(OpenMSApp.Database_A,"Select * from debitordersummary where cDebitOrderCode='"+orderCode+"'",5);
            dbItem=systems.getColumn(OpenMSApp.Database_A,"Select * from debitordersummary where cDebitOrderCode='"+orderCode+"'",2);


            creditBy=systems.getValue(OpenMSApp.Database_A,"Select * from vwMerchant where cMerchantID='"+creditByID+"'","vName");
            accountName=systems.getValue(OpenMSApp.Database_A,"Select * from Account where cAccountCode='"+accountCode+"'","vAccountName");
            accountUnit=systems.getValue(OpenMSApp.Database_A,"Select * from Account where cAccountCode='"+accountCode+"'","vAccountUnit");
            transactionType=systems.getValue(OpenMSApp.Database_A,"Select * from TransactionType where cTransactionTypeCode='"+transactionTypeCode+"'","vTransactionType");
            String OrderEmployeeID=systems.getValue(OpenMSApp.Database_A,"Select * from login where cLoginCode= '"+orderByID+"'","cEmployeeID");

            orderBy=systems.getValue(OpenMSApp.Database_A,"Select * from Employee where cEmployeeID='"+OrderEmployeeID+"'","vFirstName").trim()+" "+
                    systems.getValue(OpenMSApp.Database_A,"Select * from Employee where cEmployeeID='"+OrderEmployeeID+"'","vMiddleName").trim()+" "+
                    systems.getValue(OpenMSApp.Database_A,"Select * from Employee where cEmployeeID='"+OrderEmployeeID+"'","vlastName").trim();

            orderDate=systems.getValue(OpenMSApp.Database_A,"Select * from debitOrder where cDebitOrderCode='"+orderCode+"'","dOrderDate");
            String refDepartment=systems.getValue(OpenMSApp.Database_A,"Select * from department where cDepartmentCode='"+refDepartmentCode+"'","vDepartmentName");

            jNameTextField.setText(creditBy.trim());
            jTransactionTypeTextField.setText(transactionType.trim());
            jTransactionNumberTextField.setText(transactionNumber.trim());
            jTransactionUnitTextField.setText(accountUnit.trim());
            jTransactionDateTextField.setText(transactionDate.trim());
            try
            {
            jToBalanceTextField.setText(systems.converToRealMoneyFormat(toBalance.trim()));
            }
            catch(Exception e)
            {
                jToBalanceTextField.setText("Er!M1C01K0");
            }
            try
            {
            jAmtDueTextField.setText(systems.converToRealMoneyFormat(systems.getValue(OpenMSApp.Database_A, Connect.procInit+"  prnAddMoney"+Connect.procInitStart+""+toBalance.trim()+" , "+totalAmount.trim()+Connect.procInitEnd, "mSumValue")));
            }
            catch(Exception e)
            {
                jAmtDueTextField.setText("Er!M1C01K0");
            }
            try
            {
                jTotAmountTextField.setText(systems.converToRealMoneyFormat(totalAmount.trim()));
            }
            catch(Exception e)
            {
                jTotAmountTextField.setText("Er!M1C01K0");
            }
            jAccountNameTextField.setText(accountName.trim());
            jOrderDateTextField.setText(orderDate.trim());
            jRefDepartmentTextField.setText(refDepartment.trim());
            jActivityTextField.setText(systems.getValue(OpenMSApp.Database_A, "Select * from debitorder where cDebitOrderCode='"+orderCode+"'", "cActivity"));
            refreshTable();
            setTitle("::. View Pending Debit Order - Order By User ("+orderBy+")");
            OpenMSApp.PrintCreditOrderCode=orderCode;
        }
    }
    private void jRefDepartmentTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRefDepartmentTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jRefDepartmentTextFieldActionPerformed

    private void jTransactionTypeTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTransactionTypeTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTransactionTypeTextFieldActionPerformed

    private void jTransactionNumberTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTransactionNumberTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTransactionNumberTextFieldActionPerformed

    private void jTransactionDateTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTransactionDateTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTransactionDateTextFieldActionPerformed

    private void jCostOrderCodeTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCostOrderCodeTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jCostOrderCodeTextFieldActionPerformed

    private void jAccountNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jAccountNameTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jAccountNameTextFieldActionPerformed

    private void jTransactionUnitTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTransactionUnitTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTransactionUnitTextFieldActionPerformed

    private void jActivityTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jActivityTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jActivityTextFieldActionPerformed

private void jAmtDueTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jAmtDueTextFieldActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jAmtDueTextFieldActionPerformed

private void jToBalanceTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToBalanceTextFieldActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jToBalanceTextFieldActionPerformed

private void jCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCancelButtonActionPerformed

        if(processThread.isAlive())
        {
            try{
                processThread.stop();
                titleThread.stop();
                System.out.println("Threads successfully stopped.");
            }catch(Exception e){System.out.println("Thread stopping error: "+e);}
            this.setTitle("::. View  Pending Debit Order");
            enableControls();
        }
        else
        dispose();
}//GEN-LAST:event_jCancelButtonActionPerformed

    public void resetOrderCode()
    {
        String[] orderCode=systems.getTableDataArray(OpenMSApp.Database_A,"vwPendingDebitOrder",1);
        orderCode[0]="-- Select --";
        jComboBox1.setModel(new DefaultComboBoxModel(orderCode));
        setTitle("::. View Pending Debit Order");
    }
    public void resetTable()
    {
        tableObject=new Object[][]{};
        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            tableObject,
            new String [] {
                "S/N", "Item","Description", "Amount"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false,false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
    }
    private void setProcessingTitle(Thread thread)
    {
        try{
            this.setTitle("::. View  Pending Debit Order - Processing Request");
            thread.sleep(500);
            this.setTitle("::. View  Pending Debit Order - Processing Request.");
            thread.sleep(500);
            this.setTitle("::. View  Pending Debit Order - Processing Request..");
            thread.sleep(500);
            this.setTitle("::. View  Pending Debit Order - Processing Request...");
            thread.sleep(500);
        }catch(Exception e){System.out.println("Title thread"+e);}
    }
    private void disableControls()
    {
        jComboBox1.setEnabled(false);
        jPreviewButton.setEnabled(false);
    }
    private void enableControls()
    {
        jComboBox1.setEnabled(true);
        jPreviewButton.setEnabled(true);
        if(jComboBox1.getSelectedItem().toString().equalsIgnoreCase("-- Select --"))
        setTitle("::. View Pending Debit Order");
        else
        setTitle("::. View Pending Debit Order - Order By User ("+orderBy+")");
    }
    public void resetField()
    {
            jNameTextField.setText("");
            jTotAmountTextField.setText("");
            jToBalanceTextField.setText("");
            jAmtDueTextField.setText("");
            jOrderDateTextField.setText("");
            jTransactionTypeTextField.setText("");
            jTransactionNumberTextField.setText("");
            jTransactionUnitTextField.setText("");
            jAccountNameTextField.setText("");
            jRefDepartmentTextField.setText("");
            jCostOrderCodeTextField.setText("");
            jTransactionDateTextField.setText("");
            jActivityTextField.setText("");
    }
    public void resetCombo()
    {
        resetOrderCode();
    }
    public void reset()
    {
        resetField();
        resetTable();
        resetCombo();
    }
    public void refreshTable()
    {
        int x=0;
        int y=dbSerial.length;

        tableObject=new Object[y][4];

        while(x<y)
        {
            String itemName=systems.getValue(OpenMSApp.Database_A, "Select * from Item where cItemCode='"+dbItem[x].trim()+"'", "vName");
            
            tableObject[x][0]=dbSerial[x].trim();
            tableObject[x][1]=itemName.trim();
            tableObject[x][2]=dbDescription[x].trim();
            try
            {
                tableObject[x][3]=systems.converToRealMoneyFormat(dbAmount[x].trim());
            }
            catch(Exception e)
            {
                tableObject[x][3]="Er!M1C01K0";
            }
            systems.freeHeap();
        x+=1;
        if(x==y){break;}
       }

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            tableObject,
            new String [] {
                "S/N","Item", "Description", "Amount"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false,false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTable1.getColumnModel().getColumn(0).setMinWidth(40);
        jTable1.getColumnModel().getColumn(0).setPreferredWidth(40);
        jTable1.getColumnModel().getColumn(0).setMaxWidth(40);
        jTable1.getColumnModel().getColumn(1).setPreferredWidth(10);
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField jAccountNameTextField;
    private javax.swing.JTextField jActivityTextField;
    private javax.swing.JTextField jAmtDueTextField;
    private javax.swing.JButton jCancelButton;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JCheckBox jCheckBox2;
    private javax.swing.JCheckBox jCheckBox5;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JTextField jCostOrderCodeTextField;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JTextField jNameTextField;
    private javax.swing.JTextField jOrderDateTextField;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JButton jPreviewButton;
    private javax.swing.JTextField jRefDepartmentTextField;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JTextField jToBalanceTextField;
    private javax.swing.JTextField jTotAmountTextField;
    private javax.swing.JTextField jTransactionDateTextField;
    private javax.swing.JTextField jTransactionNumberTextField;
    private javax.swing.JTextField jTransactionTypeTextField;
    private javax.swing.JTextField jTransactionUnitTextField;
    // End of variables declaration//GEN-END:variables

}
